<template>
	<view>
		<scroll-view class="scroll-view" scroll-y="true" :style="'height:'+scriptHeight+'px'">
			<view class="item" v-for="(item,index) in list" @click="tourl(item.serial_id)" :key="index">
				<view class="time">{{item.time}}</view>
				<view class="score">{{item.score}}</view>
				<view class="arror-right"><uni-icons type="arrowright"></uni-icons></view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"scriptHeight":400,
				'list':[
						// {
						// 	'id':1,
						// 	'time':"2021-05-23 10:23:32",
						// 	'score':22,
						// 	'serial_id':23232323,
						// },{
						// 	'id':2,
						// 	'time':"2021-05-23 10:23:32",
						// 	'score':22,
						// 	'serial_id':23232323,
						// },{
						// 	'id':3,
						// 	'time':"2021-05-23 10:23:32",
						// 	'score':22,
						// 	'serial_id':23232323,
						// }
				],
			}
		},
		onReady() {
			// console.log("=======");
			// console.log(this.openid);
			// console.log(this.websiteUrl);
			this.scriptHeight = uni.getSystemInfoSync().windowHeight;
		}, 
		
		onLoad() {
			let that = this;
			uni.request({
				url: that.websiteUrl+'/myrecord',
				method:'POST',
				header: {
				        'x-requested-with': 'xmlhttprequest' //自定义请求头信息
				    },
				data:{
					'openid':that.openid,
				},
				success:(res)=>{
					if(res.data.code != 1){
						uni.showToast({
							title:res.data.msg,
							duration:2000,
							icon:'none',
						})
					} else {
						that.list = res.data.data;
					}
				}
			})
		},
		methods: {
			tourl:function(serial_id){
				console.log(serial_id);
				uni.navigateTo({
					url:"../myscorerecord/myscorerecord?serial_id="+serial_id
				}) 
			}
		}
	}
</script>

<style lang="scss">
.scroll-view{
	height: 450px;
	background-color: $uni-scroll-bg-clolr;
	.item{
		height:50px;
		display: flex;
		background-color: $uni-bg-color;
		align-items: center;
		margin: 10px;
		font-size: 15px;
		font-weight: bold;
		border-radius: 5px;
		.time{
			margin-left: 10px;
			width: 70%;
			color:$uni-text-color;
		}
		.score{
			width:20%;
			color:$uni-primary-color;
			// background-color: #3F536E;
		}
		.arror-right{
			width:10%;
			display: flex;
			justify-content: flex-end;
			margin-right: 10px;
			// background-color: #007AFF;
		}
	}
}
</style>
